package com.zr.planclass.mapper;

import com.zr.planclass.pojo.PlanClassSelectVo;
import com.zr.planclass.pojo.PlanClassVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * Created by Administrator on 2019/9/21.
 */
@Mapper
public interface PlanClassMapper {
    @Select("select * from planclass where name=#{name}")
    List<PlanClassVo> queryByName(String name);
    List<String> queryByNames(List<String> names);

    @Select("select * from planclass where code=#{code}")
    List<PlanClassVo> queryByCode(String code);
    List<String> queryByCodes(List<String> codes);

    @Insert("insert into planclass (name,code,remark,status,createName,createTime,updateName,updateTime) values" +
            "(#{name},#{code},#{remark},#{status},#{createName},#{createTime},#{updateName},#{updateTime})")
    void add(PlanClassVo planClassVo);
    void addList(List<PlanClassVo> planClassVoList);

    @Update("update planclass set status=#{status},updateName=#{updateName},updateTime=#{updateTime} where id=#{id}")
    void updateStatus(PlanClassVo planClassVo1);

    @Update("update planclass set name=#{name},remark=#{remark},status=#{status}," +
            "updateName=#{updateName},updateTime=#{updateTime},version=#{version}+1 where id=#{id} and version =#{version}")
    int update(PlanClassVo planClassVo1);

    int queryCount(PlanClassSelectVo planClassSelectVo);

    List<PlanClassVo> queryData(PlanClassSelectVo planClassSelectVo);
    List<PlanClassVo> queryDataExport(PlanClassSelectVo planClassSelectVo);

    @Select("select * from planclass where id=#{id}")
    PlanClassVo queryById(Integer id);
}
